package search;

import java.util.Arrays;

public class FibonacciSerach {
    public static void main(String[] args) {
        int[] arr1 = new int[]{1,8,10,89,1000,1234};
        int[] arr = fib();
        int k = 0;
        while(arr1.length-1>arr[k]-1){
            k++;
        }
       int[] temp= Arrays.copyOf(arr1,arr[k]);
        System.out.println(Arrays.toString(temp));
        System.out.println("k="+k+"--"+Arrays.toString(arr));
    }

    public static int[] fib() {
        int[] arr = new int[20];
        arr[1] = 1;
        arr[0] = 1;
        for (int i = 2; i < arr.length; i++) {
            arr[i] = arr[i - 1] + arr[i - 2];
        }
        return arr;
    }
}